<template>
  <el-card shadow="hover" class="stat-card">
    <div class="stat-content">
      <div class="stat-icon">
        <el-icon>
          <component :is="iconComponent" />
        </el-icon>
      </div>
      <div class="stat-info">
        <div class="stat-title">{{ title }}</div>
        <div class="stat-value">{{ value }}</div>
      </div>
    </div>
  </el-card>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { Document, CircleCheck, Timer, List, Warning } from '@element-plus/icons-vue'

interface Props {
  title: string
  value: string
  icon: 'Document' | 'CircleCheck' | 'Timer' | 'List' | 'Warning'
}

const props = defineProps<Props>()

const iconComponent = computed(() => {
  const iconMap = {
    Document,
    CircleCheck,
    Timer,
    List,
    Warning
  }
  return iconMap[props.icon] || Document
})
</script>

<style scoped>
.stat-card {
  height: 120px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #409eff 0%, #66b1ff 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: rgba(64, 158, 255, 0.3);
}

.stat-card:hover::before {
  transform: scaleX(1);
}

.stat-content {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 4px;
  position: relative;
  z-index: 1;
}

.stat-icon {
  font-size: 40px;
  margin-right: 20px;
  color: #409eff;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(64, 158, 255, 0.1) 0%, rgba(64, 158, 255, 0.05) 100%);
  flex-shrink: 0;
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(5deg);
  background: linear-gradient(135deg, rgba(64, 158, 255, 0.2) 0%, rgba(64, 158, 255, 0.1) 100%);
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-title {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
}

.stat-card:hover .stat-title {
  color: #475569;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.3s ease;
}

.stat-card:hover .stat-value {
  transform: scale(1.05);
}

:deep(.el-card__body) {
  padding: 20px 24px;
  height: 100%;
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .stat-card {
    height: 100px;
  }

  .stat-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    margin-right: 16px;
  }

  .stat-value {
    font-size: 24px;
  }
}
</style>

